import React from 'react';
import ChatBoxCard from '@/components/ChatBoxCard';
import classNames from 'classnames';
import { chatMessageType } from '@/types/chat';

type dialogProps = {
  dialogList: chatMessageType[];
  className?: string;
};

const Dialog: React.FC<dialogProps> = ({ dialogList, className }) => {
  return (
    <div className={classNames('flex flex-col border-t', className)}>
      {/* params */}
      <div className="h-9 "></div>
      {/* 遍历每个对象 */}
      <div className="px-8">
        {dialogList ? (
          dialogList.map((dialog, index) => (
            <ChatBoxCard
              id={dialog.id}
              key={index}
              isleft={'BOT' === dialog.role}
              text={dialog.content}
              chart={dialog.chart}
              data={dialog.data}
              sql={dialog.sql}
            />
          ))
        ) : (
          <></>
        )}
      </div>
    </div>
  );
};

export default Dialog;
